<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>元素属性</title>
    <script src="../node_modules/react/umd/react.development.js"></script>
    <script src="../node_modules/react-dom/umd/react-dom.development.js"></script>
    <script src="../node_modules/babel-standalone/babel.min.js"></script>
</head>

<body>
    <div id="root"></div>
    
    <script type="text/babel">
        const arr = [
            "抽烟", "喝酒", "发表情包"
        ]

        /* 将arr渲染为3个p元素 */
        const jsxArr = arr.map(
            // (str, index) => {
            //     return (
            //         // key必须与内容有唯一的对应关系
            //         <p key={index + str}>{str}</p>
            //     )
            // }
            (str, index) => <p key={index + str}>{str}</p>
        )

        ReactDOM.render(jsxArr, document.querySelector("#root"))
    </script>
</body>

</html>